package com.code.base.dic.service;

import java.util.List;
import java.util.Date;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.dic.persistence.DicCoreMapper;
import com.code.base.dic.pojo.DicCore;
import com.code.util.PrimaryKeyUtil;


@Service
public class DicCoreService {


	@Resource
	private DicCoreMapper dicCoreMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public DicCore getDataById(Long id) {
		return dicCoreMapper.getDataById(id);
	}

	public List<DicCore> getAllData() {
		return dicCoreMapper.getAllData();
	}

	public int getDataCountByCondition(DicCore entity) {
		return dicCoreMapper.getDataCountByCondition(entity);
	}

	public List<DicCore> getDataByCondition(DicCore entity) {
		return dicCoreMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(DicCore entity) {
		return dicCoreMapper.getDataCountByLikeCondition(entity);
	}

	public List<DicCore> getDataByLikeCondition(DicCore entity) {
		return dicCoreMapper.getDataByLikeCondition(entity);
	}

	public List<DicCore> getDataByIds(Long[] ids) {
		return dicCoreMapper.getDataByIds(ids);
	}

	public void insertData(DicCore entity) {
		insertData(entity, true);
	}

	public void insertData(DicCore entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		dicCoreMapper.insertData(entity);
	}

	public void updateData(DicCore entity) {
		dicCoreMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		dicCoreMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(DicCore entity) {
		dicCoreMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		dicCoreMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		dicCoreMapper.deleteDataByIds(ids);
	}

}
